package java3_29;

/**
 * 生成一注福彩号码，6个红球+1个蓝球，红球范围在1--33内，蓝球在1-16范围内，
 * 6个红球不能重复，并按照从小到大排序，最后输出（提示，List存储）
 */
    import java.util.*;
    public  class Lottery {
        public static void main(String[] args) {
            List<Integer> redBalls = new ArrayList<>();
            Random random = new Random();

            while (redBalls.size() < 6) {
                int redBall = random.nextInt(33) + 1;
                if (!redBalls.contains(redBall)) {
                    redBalls.add(redBall);
                }
            }
            Collections.sort(redBalls);

            int blueBall = random.nextInt(16) + 1;
            System.out.print("红球：");
            for (Integer ball : redBalls) {
                System.out.print(ball + " ");
            }
            System.out.println("\n蓝球：" + blueBall);
        }

    }

